//index.js
Page({
  mixins: [require('../../../utils/mixins/themeChanged')],
  /**
   * 页面的初始数据
   */
  data: {
    textareaValue: '',
    toast: false,
    warnToast: false,
    textToast: false,
    loading: false,
    hideToast: false,
    hideWarnToast: false,
    hideTextToast: false,
    hideLoading: false
  },
  onLoad: function () {

  },
  bindTextarea: function (e) {
		if(e.detail.value != this.data.textareaValue){
			this.setData({
				textareaValue: e.detail.value
			})
		}
  },
  
  // 提交反馈内容
  submitFeedBack: function (e) {
    this.openToast();
    setTimeout(() => {
      wx.navigateBack({
          delta: 1
      })
    }, 1200);
    
  },

  // 添加系统日程
  addPhoneCalendar(){
    wx.addPhoneCalendar({
      title:'增加系统日程' ,
      startTime:(new Date()).getTime() / 1000,
      description:"日程内容:一无所有，但一往无前!",
      alarm:'true',
      alarmOffset:3600,//提前1小明提醒
      success:()=>{
        console.log('addCalendar is ok')
        this.openToast();
        setTimeout(() => {
          wx.navigateBack({
              delta: 1
          })
        }, 1200);
      },
      fail:(res)=>{
        console.log(res)
      },
      complete:(res)=>{
        console.log(res)
      }
    })
  },

  // 打开弹框提示
  openToast: function() {
    this.setData({
        toast: true
    });
    setTimeout(() => {
        this.setData({
            hideToast: true
        });
        setTimeout(() => {
            this.setData({
                toast: false,
                hideToast: false,
            });
        }, 300);
    }, 3000);
  },

});
